package com.example.task1.ui.AllService.parking;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.example.task1.R;
import com.example.task1.bean.ParkingNumBean;
import com.example.task1.ui.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

public class ParkingNumAdapter extends BaseAdapter<ParkingNumBean.RowsDTO> {

    private Context context;
    private List<ParkingNumBean.RowsDTO> mData = new ArrayList<>();
    private TextView tvName;
    private TextView tvMoney;
    private TextView tvTime;

    public ParkingNumAdapter(Context context) {
        this.context = context;
    }

    @Override
    protected void setData(List<ParkingNumBean.RowsDTO> rows) {
        mData.clear();
        mData.addAll(rows);
        notifyDataSetChanged();
    }

    @Override
    protected int getLayout() {
        return R.layout.parkingnumlist;
    }

    @Override
    protected Context getContext() {
        return null;
    }

    @Override
    protected List<ParkingNumBean.RowsDTO> getData() {
        return mData;
    }

    @Override
    protected void onBind(myHolder holder, ParkingNumBean.RowsDTO date) {
        tvMoney.setText(date.getScore());
        tvName.setText(date.getEvent());
        tvTime.setText(date.getChangeDate());
    }

    @Override
    protected void holder(View view) {
        initView(view);
    }

    private void initView(View view) {
        tvName = view.findViewById(R.id.tv_name);
        tvMoney = view.findViewById(R.id.tv_money);
        tvTime = view.findViewById(R.id.tv_time);
    }
}
